home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1998 November / Freeware November 1998.img / dist / fw_GNUbash.idb / usr / freeware / src / bash-1.14.6 / alias.h.z / alias.h
C/C++ Source or Header  |  1998-01-21  |  2KB  |  76 lines

  1. /* alias.h -- structure definitions. */
  2.  
  3. /* Copyright (C) 1987,1991 Free Software Foundation, Inc.
  4.  
  5.    This file is part of GNU Bash, the Bourne Again SHell.
  6.  
  7.    Bash is free software; you can redistribute it and/or modify it
  8.    under the terms of the GNU General Public License as published by
  9.    the Free Software Foundation; either version 1, or (at your option)
  10.    any later version.
  11.  
  12.    Bash is distributed in the hope that it will be useful, but WITHOUT
  13.    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  14.    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
  15.    License for more details.
  16.  
  17.    You should have received a copy of the GNU General Public License
  18.    along with Bash; see the file COPYING.  If not, write to the Free
  19.    Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
  20.  
  21. #if !defined (_ALIAS_)
  22. #define _ALIAS_
  23.  
  24. #include "hash.h"
  25.  
  26. extern char *xmalloc ();
  27.  
  28. #if !defined (whitespace)
  29. #  define whitespace(c) (((c) == ' ') || ((c) == '\t'))
  30. #endif /* !whitespace */
  31.  
  32. #if !defined (savestring)
  33. #  define savestring(x) (char *)strcpy (xmalloc (1 + strlen (x)), (x))
  34. #endif /* !savestring */
  35.  
  36. #if !defined (NULL)
  37. #  if defined (__STDC__)
  38. #    define NULL ((void *) 0)
  39. #  else
  40. #    define NULL 0x0
  41. #  endif /* !__STDC__ */
  42. #endif /* !NULL */
  43.  
  44. typedef struct {
  45.   char *name;
  46.   char *value;
  47. } ASSOC;
  48.  
  49. /* The list of known aliases. */
  50. extern HASH_TABLE *aliases;
  51.  
  52. extern void initialize_aliases ();
  53.  
  54. /* Scan the list of aliases looking for one with NAME.  Return NULL
  55.    if the alias doesn't exist, else a pointer to the assoc. */
  56. extern ASSOC *find_alias ();
  57.  
  58. /* Return the value of the alias for NAME, or NULL if there is none. */
  59. extern char *get_alias_value ();
  60.  
  61. /* Make a new alias from NAME and VALUE.  If NAME can be found,
  62.    then replace its value. */
  63. extern void add_alias ();
  64.  
  65. /* Remove the alias with name NAME from the alias list.  Returns
  66.    the index of the removed alias, or -1 if the alias didn't exist. */
  67. extern int remove_alias ();
  68.  
  69. /* Return a new line, with any aliases expanded. */
  70. extern char *alias_expand ();
  71.  
  72. /* Return an array of all defined aliases. */
  73. extern ASSOC **all_aliases ();
  74.  
  75. #endif /* _ALIAS_ */
  76.